/*
 * GeoVISTA Center (Penn State, Dept. of Geography)
 * Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
 * Licensed under Simplified BSD License
 *
 *
 * @Original Author: jin Chen
 * @date: Jan 19, 2005$
 * @version: 1.0
 */
package edu.psu.geovista.app.visualclassifier.classify.v2.gui;

import edu.psu.geovista.classification.Range;

import java.awt.*;

public class CategoryValuePane extends javax.swing.JPanel {

    /** Creates new form CategoryValuePane */
    public CategoryValuePane() {
        initComponents();
    }
    public void setVarName(String s){
        this.varNameLb.setText(s);
    }
    public void setRange(Range r){
        //todo limited length of data shown
        double max = r.getMax();
        double min = r.getMin();
        String smax=String.valueOf(max);
        if(smax!=null&&smax.length() >6){
            smax=smax.substring(0,6);
        }
        String smin=String.valueOf(min);
        if(smin!=null&&smin.length() >6){
            smin=smin.substring(0,6);
        }
        this.maxLb.setText("Max: "+smax);
        this.minLb.setText("Min: "+smin);
    }
    /*public void setVarBounds(String s){
        this.minLb.setText(s);
    }*/
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {
        varNameLb = new javax.swing.JLabel();
        minLb = new javax.swing.JLabel();
        maxLb=new javax.swing.JLabel();
        setLayout(new java.awt.GridLayout(3, 1));

        varNameLb.setFont(new java.awt.Font("Arial", Font.BOLD , 14)); //MS Sans Serif
        varNameLb.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        varNameLb.setText("jLabel1");
        varNameLb.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING );
        add(varNameLb);

        minLb.setFont(new java.awt.Font("Arial", Font.PLAIN , 12));
        minLb.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        minLb.setText("jLabel2");
        add(minLb);

        maxLb.setFont(new java.awt.Font("Arial", Font.PLAIN , 12));
        maxLb.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        maxLb.setText("jLabel3");
        add(maxLb);

    }


    // Variables declaration - do not modify
    private javax.swing.JLabel minLb;
     private javax.swing.JLabel maxLb;
    private javax.swing.JLabel varNameLb;
    // End of variables declaration

}

